package com.catazy.module_project.viewmodel

import androidx.lifecycle.ViewModel
import androidx.lifecycle.ViewModelProvider
import com.catazy.module_project.repository.ProjectRepository
import dagger.hilt.android.scopes.ActivityRetainedScoped
import javax.inject.Inject

/**
 * 作者: Tao
 * 日期: 2024/5/7
 * 时间: 10:06
 * 描述: 项目ViewModel工厂
 */
@ActivityRetainedScoped
class ProjectViewModelFactory @Inject constructor(private val repository: ProjectRepository) :
    ViewModelProvider.NewInstanceFactory() {

    @Suppress("UNCHECKED_CAST")
    override fun <T : ViewModel> create(modelClass: Class<T>): T {
        return ProjectViewModel(repository) as T
    }
}